<?php
/**
 * Object Interface.
 * @package safsi
 */

require_once('safsi_exception_Exception.php');

/**
 * Object Interface.
 * @package safsi
 */
interface safsi_IObject {

    /**
     * Get the object's name.
     * @return string Name
     */
    public function name();

    /**
     * Write object data to a resource stream.
     * @param resource $resource Content will be written to this stream
     */
    public function writeDataToStream($resource);

    /**
     * Read object data from a resource stream.
     * @param resource $resource Content will be read from this stream
     * @param string $contentType Content type if known
     * @param string $checksum Checksum if known
     */
    public function readDataFromStream($resource, $contentType = null, $checksum = null);

    /**
     * Write data to a file specified by name.
     * @param string $filename File name to write data
     */
    public function writeDataToFilename($filename);

    /**
     * Read data from a file specified by name.
     * @param string $filename File name to read data
     * @param string $contentType Content type if known
     * @param string $checksum Checksum if known
     */
    public function readDataFromFilename($filename, $contentType = null, $checksum = null);

    /**
     * Get the content of the object.
     * @return string Data
     */
    public function data();

    /**
     * Set the content of the object.
     * @param string $data Data
     * @param string $contentType Content type if known
     * @param string $checksum Checksum if known
     */
    public function setData($data, $contentType = null, $checksum = null);

    /**
     * Get the checksum for the object.
     * @return string checksum
     */
    public function checksum();

    /**
     * Get the content type for the object.
     * @return string Content type
     */
    public function contentType();

}

?>
